﻿using System;
using System.IO;

namespace YJKDataBase
{
	public class PathIni
	{
		private static string GetIniPath()
		{
			return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Hongye");
		}

		public static string ReadPath(string verNO)
		{
			string text = "";
			string inipath = Path.Combine(PathIni.GetIniPath(), "HYBIMDB", "HYRME.ini");
			if (!(verNO == "2014"))
			{
				if (!(verNO == "2015"))
				{
					if (!(verNO == "2016"))
					{
						if (verNO == "2017")
						{
							text = new INIClass(inipath).IniReadValue("2017", "Location");
						}
					}
					else
					{
						text = new INIClass(inipath).IniReadValue("2016", "Location");
					}
				}
				else
				{
					text = new INIClass(inipath).IniReadValue("2015", "Location");
				}
			}
			else
			{
				text = new INIClass(inipath).IniReadValue("2014", "Location");
			}
			if (text == "")
			{
				return "";
			}
			bool flag = false;
			string path = Path.Combine(text, "FamilyLib");
			if (!Directory.Exists(path))
			{
				return "";
			}
			FileInfo[] files = new DirectoryInfo(path).GetFiles();
			for (int i = 0; i < files.Length; i++)
			{
				if (files[i].Name.Contains("Architecture"))
				{
					flag = true;
					break;
				}
			}
			if (flag)
			{
				return Path.Combine(text, "FamilyLib");
			}
			return "";
		}
	}
}
